/**
 * 版权所有 @鸿名物联 
 * 未经授权，禁止侵权和商业用途，违法必究
 * 联系QQ：2224313811 
 * 
 */
package com.lp;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.DispatcherServlet;

import com.lp.authority.AuthorityIntercept;
import com.lp.authority.WechatAuthorityIntercept;

public class Dispatcher extends DispatcherServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void doDispatch(HttpServletRequest req, HttpServletResponse response) throws Exception {
		
		// 微信公众号授权拦截
		int statusCode = WechatAuthorityIntercept.AutjorityIntercept(req, response) ;
		
		if(statusCode == 0 ){
			super.doDispatch(req, response);
		}else if(statusCode == 1){
			return ;
		}else{
			// 权限判断
			if(AuthorityIntercept.AutjorityIntercept(req, response)){
				super.doDispatch(req, response);			
			}			
		}
	}
}
